<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>我的错题本</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/semantic.min.js}">
    </script>
</head>
<body>
<!--分割线-->
<h2 class="ui center aligned blue icon header">
    <i class="circular student icon"></i>
    温故而知新
</h2>
<!--分割线-->

<!--选项框-->
<div class="layui-tab">
    <ul class="layui-tab-title" >
        <li class="layui-this">开始练习</li>
        <li th:each="book,iterStat:${books}" th:text="'第'+${iterStat.index+1}+'题'"></li>
    </ul>

    <div class="layui-tab-content" >
        <div class="layui-tab-item layui-show" >
            <h3 class="ui blue header">子曰：“学而时习之，不亦说乎”</h3>
            <a class="ui primary animated fade button" th:href="@{/stu/item/myerror_book/export_word}">
                <div class="visible content">打印</div>
                <div class="hidden content">
                    word文档
                </div>
            </a>
        </div>

        <div class="layui-tab-item " th:each="book,iterStat:${books}" >
            <div class="ui container">
                <div class="ui segment">
                    <h3 class="ui orange header" th:text="${'题目：'+book.subject}"></h3>
                    <form  method="post"  class="layui-form" >

                        <div class="layui-form-item" th:if="${book.type_id!=3}">
                            <div class="layui-input-block">
                                <input type="radio"  th:name="${book.id}" value="[A]" checked="checked" th:title="'A:'+${book.answer_a}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block" th:if="${book.type_id!=3}">
                                <input type="radio"  th:name="${book.id}" value="[B]"  th:title="'B:'+${book.answer_b}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block" th:if="${book.type_id!=3}">
                                <input type="radio"  th:name="${book.id}" value="[C]"  th:title="'C:'+${book.answer_c}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block" th:if="${book.type_id!=3}">
                                <input type="radio"  th:name="${book.id}" value="[D]"  th:title="'D:'+${book.answer_d}">
                            </div>
                        </div>

                        <!--                    提示-->
                        <div class="ui  accordion">
                            <div class="title"  data-title="先自己思考后再看答案哦">
                                查看答案及解析：
                                <i class="dropdown icon">
                                </i>
                            </div>
                            <div class="content">
                                <label th:utext="'答案：'+${book.answer_true}+'<br>解析：'+${book.description}"></label>
                            </div>
                        </div>
                        <!--                    提示-->
                        <br>
                        <div id="buttonsuccess" class="ui pink  button" th:onclick="|deleteerrorbook(${book.id})|">我已学会，斩</div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--选项框-->

</body>
<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });

    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });

    function deleteerrorbook(id)
    {
        console.log(id);
        $.post(
            '/stu/item/myerror_book/delete',
            {'id':id},
            function (result) {
                //刷新页面
                location.href = '/stu/item/myerror_book/';
            }
        )
    }

    $(document).ready(function(){
        $('.ui.accordion').accordion();
        $('.title').popup();
    });
</script>
</html>